<?php 
require_once 'controller/config.inc';
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="shortcut icon" href="../favicon.png">
 <script src="js/jquery.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/popover.js"></script>
    <script>
    $(function(){
    	$('a').tooltip({'placement':'right', 'trigger' : 'hover'});
    });
    </script>
    <title>Online Shopping</title>

    <!-- Bootstrap core CSS -->
    <link href="css/bootstrap.css" rel="stylesheet">
	<link href="css/font-awesome.css" rel="stylesheet">
    <!-- Custom styles for this template -->
    <link href="jumbotron.css" rel="stylesheet">

    <!-- Just for debugging purposes. Don't actually copy this line! -->
    <!--[if lt IE 9]><script src="../../js/ie8-responsive-file-warning.js"></script><![endif]-->

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
    <![endif]-->
  </head>

  <body>

    <div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="index.html#">Kharidaree</a>
        </div>
        <div class="navbar-collapse collapse">
         <a href='#' class='pull-right btn btn-primary'>Customer Login</a>
        </div><!--/.navbar-collapse -->
      </div>
    </div>

    <!-- Main jumbotron for a primary marketing message or call to action -->
    <div class="jumbotron">
      <div class="container">
        <h1>Edit Item!</h1>
        <p>This is a template for a simple marketing or informational website. It includes a large callout called a jumbotron and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
        <p><a class="btn btn-primary btn-lg" role="button">Learn more &raquo;</a></p>
      </div>
    </div>

    <div class="container">
      <!-- Example row of columns -->
      <div class="row">
      
       <?php 
  if(isset($_GET['status'])){
  		if($_GET['status']==success){
  		echo "<div class='alert alert-success'>Item has been Delete!</div>";
  		}
  		else{
  			echo "<div class='alert alert-error'>Denied! You have no privileges to Delete this Item</div>";
  			
  		}
  }
  ?>
       <!-- Nav tabs -->
<ul class="nav nav-tabs" id='myTab'>
  <li><a href="#home" data-toggle="tab">Edit Item</a></li>

</ul>

<!-- Tab panes -->
<div class="tab-content">
  <div class="tab-pane active" id="home">
	<div class='row'>
	
	<br/>
	<?php 
	$id=$_GET['id'];
	$qry=mysql_query("SELECT * FROM items WHERE id=$id");
	$row=mysql_fetch_array($qry);
	?>
	<form class="form-inline" role="form" action='controller/upload_photo.php' method="post"
enctype="multipart/form-data">
  <div class="form-group">
    <label class="sr-only" for="exampleInputEmail2">Select Photo:</label>
    <input type="file" value="<?php echo $row['photo'];?>" class="form-control" id="exampleInputEmail2" name='f_photo'>
  </div>
 
 
  <button type="submit" class="btn btn-primary">Upload Photo</button>
</form>


	<form class="form-horizontal" role="form" action='controller/editItem.php' method='POST'>
		<div class='col-md-6'>
			<br class='clearfix'/>
			
  <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">Serial Number:</label>
    <div class="col-sm-10">
      <input type="text" value="<?php echo $row['sn'];?>" class="form-control" id="inputEmail3" name="sn">
    </div>
  </div>
   <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">Name:</label>
    <div class="col-sm-10">
      <input type="text" value="<?php echo $row['name'];?>" class="form-control" id="inputEmail3" name="nm">
    </div>
  </div>
   <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">Category: (<?php echo "<small>" .$row['category'] . "</small>"; ?>)</label>
    <div class="col-sm-10">
      <select class="form-control" name='cat'>
      <option value=''>Select Category</option>
  <option value='Devices'>Devices</option>
  <option value='Wearables'>Wearables</option>
  <option value='Computers'>Computers</option>
  <option value='Books'>Books</option>
  <option value='Jewererly'>Jewererly</option>
</select>
    </div>
  </div>
   <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">Size</label>
    <div class="col-sm-10">
      <input type="text" value="<?php echo $row['size'];?>" class="form-control" id="inputEmail3" name='size'>
    </div>
  </div>
  <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label">Price</label>
    <div class="col-sm-10">
      <input type="text" value="<?php echo $row['price'];?>" class="form-control" name='price'>
    </div>
  </div>
  


		</div>
		
		<div class='col-md-6'>
		<br/>
		<div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">Manufacturer</label>
    <div class="col-sm-10">
      <input type="text" value="<?php echo $row['manf'];?>" class="form-control" name='manf'>
    </div>
  </div>
   <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">Status</label>
    <div class="col-sm-10">
      <input type="text" value="<?php echo $row['status'];?>" class="form-control" name='status'>
    </div>
  </div>
  <?php 
  if(isset($_GET['fn'])){
  		$file=$_GET['fn'];
  	
  }
  ?>
   <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">Photo</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" value="<?php echo $row['photo'];?>" name='photo' value='<?php echo $file; ?>'>
      <input type="hidden" value="<?php echo $row['id'];?>" name='id'>
    </div>
  </div>
  

			  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-primary">Edit Item</button>
    </div>
  </div>
		</div>
		
		</form>
	
	</div>
</div>
<!-- /Add Item -->
  
  
</div>

<script>
  $(function () {
	  $('#myTab a').click(function (e) {
		  e.preventDefault();
		  $(this).tab('show');
		});
  });
</script>
      </div>

      <hr>

      <footer>
        <p>&copy; Company 2013</p>
      </footer>
    </div> <!-- /container -->


    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
   
  </body>
</html>
